-------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/Building_sample.log
  log type:  text
 opened on:  12 May 2020, 18:27:19

. 
. 
. *________________________________________ CLEANING DATA
. ** NUTS CODES
. import excel ${dirin}nuts_codes.xls, sheet("Foglio1") firstrow clear

. rename  Codiceprovincia cod_prov

. rename  CodiceNUTS32006 cod_prov_nuts

. rename Denominazioneprovincia name_prov

. label var name_prov "Province name"

. label var name_reg "Region name"

. label var cod_prov "Province code (ISTAT)"

. label var cod_prov_nuts "Province code (NUTS3)"

. replace  name_prov=lower(name_prov)
(109 real changes made)

. replace  name_reg=lower(name_reg)
(109 real changes made)

. destring, replace
cod_prov has all characters numeric; replaced as int
cod_prov_nuts contains nonnumeric characters; no replace
name_prov contains nonnumeric characters; no replace
name_reg contains nonnumeric characters; no replace

. save ${dirout}nuts_codes.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/nuts_codes.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/nuts_codes.dta saved

. 
. 
. ** DEMOGRAPHY OF ENTERPRISES
. import excel ${dirin}dem_ent.xlsx, sheet("Foglio1") firstrow clear

. reshape long nate morte registrate, i(province) j(year)
(note: j = 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      105   ->    1155
Number of variables                  34   ->       5
j variable (11 values)                    ->   year
xij variables:
         nate2003 nate2004 ... nate2013   ->   nate
      morte2003 morte2004 ... morte2013   ->   morte
registrate2003 registrate2004 ... registrate2013->registrate
-----------------------------------------------------------------------------

. rename nate new

. rename morte closed

. rename registrate registered

. rename  province name_prov

. replace name_prov=lower(name_prov)
(1144 real changes made)

. save ${dirout}dem_ent.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/dem_ent.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/dem_ent.dta saved

. 
. 
. ** ENTERPRISES CONSTRUCTION SECTOR
. import excel ${dirin}construction.xls, sheet("Foglio1") firstrow clear

. destring, replace
nome_prov contains nonnumeric characters; no replace
edil2002 already numeric; no replace
edil2003 already numeric; no replace
edil2004 already numeric; no replace
edil2005 already numeric; no replace
edil2006 already numeric; no replace
edil2007 already numeric; no replace
edil2008 already numeric; no replace
edil2009 already numeric; no replace
edil2013 already numeric; no replace
edil2012 already numeric; no replace
edil2011 already numeric; no replace
edil2010 already numeric; no replace

. rename nome_prov name_prov

. replace  name_prov=lower(name_prov)
(102 real changes made)

. reshape long edil, i(name_prov) j(year)
(note: j = 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      105   ->    1260
Number of variables                  13   ->       3
j variable (12 values)                    ->   year
xij variables:
         edil2002 edil2003 ... edil2013   ->   edil
-----------------------------------------------------------------------------

. rename edil construction

. save ${dirout}construction.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/construction.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/construction.dta saved

. 
. 
. ** ENTERPRISES R&D SECTOR
. import excel ${dirin}research.xlsx, sheet("Foglio1") firstrow clear

. destring, replace
nome_prov contains nonnumeric characters; no replace
ricerca2003 already numeric; no replace
ricerca2004 already numeric; no replace
ricerca2005 already numeric; no replace
ricerca2006 already numeric; no replace
ricerca2007 already numeric; no replace
ricerca2008 already numeric; no replace
ricerca2009 already numeric; no replace
ricerca2010 already numeric; no replace
ricerca2011 already numeric; no replace
ricerca2012 already numeric; no replace
ricerca2013 already numeric; no replace

. rename nome_prov name_prov

. replace  name_prov=lower(name_prov)
(101 real changes made)

. reshape long ricerca, i(name_prov) j(year)
(note: j = 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      103   ->    1133
Number of variables                  12   ->       3
j variable (11 values)                    ->   year
xij variables:
ricerca2003 ricerca2004 ... ricerca2013   ->   ricerca
-----------------------------------------------------------------------------

. rename ricerca research

. save ${dirout}research.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/research.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/research.dta saved

. 
. 
. ** ENTERPRISES LEGAL FORM
. import excel ${dirin}legal_form.xls, sheet("Foglio1") firstrow clear

. destring, replace
nome_prov contains nonnumeric characters; no replace
sdc2003 already numeric; no replace
sdp2003 already numeric; no replace
ii2003 already numeric; no replace
other2003 already numeric; no replace
sdc2004 already numeric; no replace
sdp2004 already numeric; no replace
ii2004 already numeric; no replace
other2004 already numeric; no replace
sdc2005 already numeric; no replace
sdp2005 already numeric; no replace
ii2005 already numeric; no replace
other2005 already numeric; no replace
sdc2006 already numeric; no replace
sdp2006 already numeric; no replace
ii2006 already numeric; no replace
other2006 already numeric; no replace
sdc2007 already numeric; no replace
sdp2007 already numeric; no replace
ii2007 already numeric; no replace
other2007 already numeric; no replace
sdc2008 already numeric; no replace
sdp2008 already numeric; no replace
ii2008 already numeric; no replace
other2008 already numeric; no replace
sdc2009 already numeric; no replace
sdp2009 already numeric; no replace
ii2009 already numeric; no replace
other2009 already numeric; no replace
sdc2010 already numeric; no replace
sdp2010 already numeric; no replace
ii2010 already numeric; no replace
other2010 already numeric; no replace
sdc2011 already numeric; no replace
sdp2011 already numeric; no replace
ii2011 already numeric; no replace
other2011 already numeric; no replace
sdc2012 already numeric; no replace
sdp2012 already numeric; no replace
ii2012 already numeric; no replace
other2012 already numeric; no replace
sdc2013 already numeric; no replace
sdp2013 already numeric; no replace
ii2013 already numeric; no replace
other2013 already numeric; no replace
srl2003 already numeric; no replace
srl2004 already numeric; no replace
srl2005 already numeric; no replace
srl2006 already numeric; no replace
srl2007 already numeric; no replace
srl2008 already numeric; no replace
srl2009 already numeric; no replace
srl2010 already numeric; no replace
srl2011 already numeric; no replace
srl2012 already numeric; no replace
srl2013 already numeric; no replace

. rename nome_prov name_prov

. replace  name_prov=lower(name_prov)
(102 real changes made)

. reshape long sdc sdp ii other srl, i(name_prov) j(year)
(note: j = 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      105   ->    1155
Number of variables                  56   ->       7
j variable (11 values)                    ->   year
xij variables:
            sdc2003 sdc2004 ... sdc2013   ->   sdc
            sdp2003 sdp2004 ... sdp2013   ->   sdp
               ii2003 ii2004 ... ii2013   ->   ii
      other2003 other2004 ... other2013   ->   other
            srl2003 srl2004 ... srl2013   ->   srl
-----------------------------------------------------------------------------

. keep sdc name_prov year

. rename sdc limited

. save ${dirout}legal_form.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/legal_form.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/legal_form.dta saved

. 
. 
. ** TMI
. import excel ${dirin}tmi.xlsx, sheet("Foglio1") firstrow clear

. destring, replace
name_pr contains nonnumeric characters; no replace
mafia_index_ts already numeric; no replace
name_reg contains nonnumeric characters; no replace

. rename  name_pr name_prov

. drop if name_prov=="Ogliastra" | name_prov=="Carbonia-Iglesias" | name_prov=="Olbia-Tempio" | name_prov=="Medio C
> ampidano"
(4 observations deleted)

. sum mafia_index_ts  if name_reg!="Campania" & name_reg!="Calabria" & name_reg!="Sicilia" 

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
mafia_inde~s |        84    2.776786    4.982882        .02      27.86

. gen tmi =((mafia_index_ts -abs(r(min)))/(r(max)-r(min))) if name_reg!="Campania" & name_reg!="Calabria" & name_re
> g!="Sicilia" 
(19 missing values generated)

. sum mafia_index_ts

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
mafia_inde~s |       103    8.264854    16.89877        .02     101.57

. gen tmi_all =((mafia_index_ts -abs(r(min)))/(r(max)-r(min))) 

. drop mafia_index_ts name_reg

. replace name_prov=lower(name_prov)
(102 real changes made)

. save ${dirout}tmi.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/tmi.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/tmi.dta saved

. 
. 
. ** TMI PRE
. import excel ${dirin}tmi_pre.xlsx, sheet("Foglio1") firstrow clear

. rename nome_prov name_prov

. replace name_prov=lower(name_prov)
(101 real changes made)

. replace name_reg=lower(name_reg)
(102 real changes made)

. sum tmi_2009  if name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia" 

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
    tmi_2009 |        84    10.53071    4.801147       5.19      27.41

. gen tmi_pre =((tmi_2009 -abs(r(min)))/(r(max)-r(min))) if name_reg!="campania" & name_reg!="calabria" & name_reg!
> ="sicilia" 
(19 missing values generated)

. drop tmi_2009

. save ${dirout}tmi_pre.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/tmi_pre.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/tmi_pre.dta saved

. 
. 
. ** PSI
. import excel ${dirin}psi.xls, sheet("Foglio2") firstrow clear

. rename Province name_prov

. replace name_prov=lower(name_prov)
(102 real changes made)

. destring, replace
name_prov contains nonnumeric characters; no replace
Associazionemafiosa already numeric; no replace
Omicidipermafia already numeric; no replace
Estorsioni already numeric; no replace
Numerobeniconfiscati already numeric; no replace
Scioglimenticonsiglicomunali already numeric; no replace
Associazioneadelinquere already numeric; no replace
Produzioneotrafficostupefacen already numeric; no replace
Rapine already numeric; no replace
Usura already numeric; no replace
Sfruttamentoprostituzione already numeric; no replace

. gen psi=3 if  (Associazionemafiosa>=1 & Omicidipermafia>=1 & Estorsioni>=1) 
(94 missing values generated)

. replace psi=2 if  (Associazionemafiosa>=1 & Omicidipermafia>=1 & Estorsioni<1) | (Associazionemafiosa>=1 & Omicid
> ipermafia<1 & Estorsioni>=1) | (Associazionemafiosa<1 & Omicidipermafia>=1 & Estorsioni>=1)
(10 real changes made)

. replace psi=1 if  (Associazionemafiosa<1 & Omicidipermafia>=1 & Estorsioni<1) | (Associazionemafiosa>=1 & Omicidi
> permafia<1 & Estorsioni<1) | (Associazionemafiosa<1 & Omicidipermafia<1 & Estorsioni>=1)
(22 real changes made)

. replace psi=0 if  (Associazionemafiosa<1 & Omicidipermafia<1 & Estorsioni<1) & (Numerobeniconfiscati<1 & Scioglim
> enticonsiglicomunali<1)
(62 real changes made)

. keep name_prov psi

. save ${dirout}psi.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/psi.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/psi.dta saved

. 
. 
. ** ART. 416 BIS
. import excel ${dirin}art416_bis.xlsx, sheet("reati") firstrow clear

. replace nome_prov=lower(nome_prov)
(102 real changes made)

. rename  nome_prov name_prov

. reshape long  associazione_mafiosa, i(name_prov) j(year)
(note: j = 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      103   ->    1442
Number of variables                 141   ->     129
j variable (14 values)                    ->   year
xij variables:
associazione_mafiosa2000 associazione_mafiosa2001 ... associazione_mafiosa2013->associazione_mafiosa
-----------------------------------------------------------------------------

. keep name_prov associazione_mafiosa year

. rename associazione_mafiosa art416_bis

. save ${dirout}art416_bis.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/art416_bis.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/art416_bis.dta saved

. 
. 
. ** CONFINO LAW
. use ${dirin}confino.dta, clear

. rename nome_prov name_prov

. rename confinati confined

. save ${dirout}confino.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/confino.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/confino.dta saved

. 
. 
. ** TOURISM
. import excel ${dirin}tourism.xlsx, sheet("Foglio1") firstrow clear

. reshape long turismo_, i(Province) j(year)
(note: j = 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      110   ->    1210
Number of variables                  12   ->       3
j variable (11 values)                    ->   year
xij variables:
turismo_2003 turismo_2004 ... turismo_2013->   turismo_
-----------------------------------------------------------------------------

. rename turismo_ tourism

. rename Province name_prov

. replace  name_prov=lower(name_prov)
(1199 real changes made)

. save ${dirout}tourism.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/tourism.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/tourism.dta saved

. 
. 
. ** WASTES
. import excel ${dirin}wastes.xlsx, sheet("Foglio1") firstrow clear

. rename nome_prov name_prov

. replace  name_prov=lower(name_prov)
(106 real changes made)

. reshape long rifiuti_tot, i(name_prov) j(year)
(note: j = 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      110   ->    1210
Number of variables                  12   ->       3
j variable (11 values)                    ->   year
xij variables:
rifiuti_tot2003 rifiuti_tot2004 ... rifiuti_tot2013->rifiuti_tot
-----------------------------------------------------------------------------

. rename rifiuti_tot wastes

. save ${dirout}wastes.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/wastes.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/wastes.dta saved

. 
. 
. ** BANKS
. use ${dirin}banks.dta, clear

. foreach var in n_sportelli_minori n_sportelli_piccole n_sportelli_medie n_sportelli_grandi n_sportelli_maggiori  
> {
  2. replace  `var'=0 if `var'==.
  3. }
(54 real changes made)
(0 real changes made)
(0 real changes made)
(224 real changes made)
(0 real changes made)

. gen big_banks=(n_sportelli_grandi +n_sportelli_maggiori)/(n_sportelli_minori +n_sportelli_piccole +n_sportelli_me
> die+ n_sportelli_grandi +n_sportelli_maggiori)

. keep name_prov cod_prov_nuts year big_banks

. save ${dirout}banks.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/banks.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/banks.dta saved

. 
. 
. ** CREDITS
. use ${dirin}credits.dta, clear

. drop code_pro

. rename nome_prov name_prov 

. rename imp_tot credit_tot

. save ${dirout}credits.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/credits.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/credits.dta saved

. 
. 
. ** NEWSPAPERS
. use ${dirin}newspapers.dta, clear

. rename quotidiani newspapers

. save ${dirout}newspapers.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/newspapers.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/newspapers.dta saved

. 
. 
. ** SELF-EMPLOYED
. import excel ${dirin}self_emp.xlsx, sheet("Foglio1") firstrow clear

. replace  nome_prov=lower(nome_prov)
(101 real changes made)

. rename nome_prov name_prov

. reshape long perc_autonomi, i(name_prov) j(year)
(note: j = 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      103   ->    1133
Number of variables                  12   ->       3
j variable (11 values)                    ->   year
xij variables:
perc_autonomi2003 perc_autonomi2004 ... perc_autonomi2013->perc_autonomi
-----------------------------------------------------------------------------

. rename perc_autonomi self_emp

. save ${dirout}self_emp.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/self_emp.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/self_emp.dta saved

. 
. 
. ** BLOOD
. import excel ${dirin}blood.xlsx, sheet("sangue") firstrow clear

. rename nome_reg name_reg

. replace  name_reg=lower(name_reg)
(19 real changes made)

. reshape long sangue, i(name_reg) j(year)
(note: j = 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                       20   ->     220
Number of variables                  12   ->       3
j variable (11 values)                    ->   year
xij variables:
   sangue2003 sangue2004 ... sangue2013   ->   sangue
-----------------------------------------------------------------------------

. rename sangue blood

. save ${dirout}blood.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/blood.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/blood.dta saved

. 
. 
. ** TRIALS
. import excel ${dirin}trials.xlsx, sheet("Foglio2") firstrow clear

. destring, replace
nome_prov contains nonnumeric characters; no replace
fallimento2003 already numeric; no replace
fallimento2004 already numeric; no replace
fallimento2005 already numeric; no replace
fallimento2006 already numeric; no replace
fallimento2007 already numeric; no replace
fallimento2008 already numeric; no replace
fallimento2009 already numeric; no replace
fallimento2010 already numeric; no replace
fallimento2011 already numeric; no replace
fallimento2012 already numeric; no replace
fallimento2013 already numeric; no replace

. rename nome_prov name_prov

. replace  name_prov=lower(name_prov)
(102 real changes made)

. reshape long fallimento, i(name_prov) j(year)
(note: j = 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      103   ->    1133
Number of variables                  12   ->       3
j variable (11 values)                    ->   year
xij variables:
fallimento2003 fallimento2004 ... fallimento2013->fallimento
-----------------------------------------------------------------------------

. rename fallimento trial

. save ${dirout}trials.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/trials.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/trials.dta saved

. 
. 
. ** UNEMPLOYMENT RATE
. import excel ${dirin}un_rate.xlsx, sheet("Foglio2") firstrow clear

. destring, replace
nome_prov contains nonnumeric characters; no replace
un_rate2003 already numeric; no replace
un_rate2004 already numeric; no replace
un_rate2005 already numeric; no replace
un_rate2006 already numeric; no replace
un_rate2007 already numeric; no replace
un_rate2008 already numeric; no replace
un_rate2009 already numeric; no replace
un_rate2010 already numeric; no replace
un_rate2011 already numeric; no replace
un_rate2012 already numeric; no replace
un_rate2013 already numeric; no replace

. rename nome_prov name_prov

. replace  name_prov=lower(name_prov)
(109 real changes made)

. reshape long un_rate, i(name_prov) j(year)
(note: j = 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      110   ->    1210
Number of variables                  12   ->       3
j variable (11 values)                    ->   year
xij variables:
un_rate2003 un_rate2004 ... un_rate2013   ->   un_rate
-----------------------------------------------------------------------------

. save ${dirout}un_rate.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/un_rate.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/un_rate.dta saved

. 
. 
. ** TOTAL POPULATION
. import excel ${dirin}population.xlsx, sheet("popolazione_totale") firstrow clear

. rename nome_prov name_prov

. replace  name_prov=lower(name_prov)
(102 real changes made)

. reshape long popolazione_totale, i(name_prov) j(year)
(note: j = 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      103   ->    1133
Number of variables                  12   ->       3
j variable (11 values)                    ->   year
xij variables:
popolazione_totale2003 popolazione_totale2004 ... popolazione_totale2013->popolazione_totale
-----------------------------------------------------------------------------

. rename popolazione_totale pop_tot

. save ${dirout}pop_tot.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/pop_tot.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/pop_tot.dta saved

. 
. 
. ** URBAN POPULATION
. import excel ${dirin}population.xlsx, sheet("popolazione_urbana") firstrow clear

. rename nome_prov name_prov

. replace  name_prov=lower(name_prov)
(0 real changes made)

. reshape long popolazione_urbana, i(name_prov) j(year)
(note: j = 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      104   ->    1144
Number of variables                  12   ->       3
j variable (11 values)                    ->   year
xij variables:
popolazione_urbana2003 popolazione_urbana2004 ... popolazione_urbana2013->popolazione_urbana
-----------------------------------------------------------------------------

. rename popolazione_urbana popurban

. save ${dirout}pop_urb.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/pop_urb.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/pop_urb.dta saved

. 
. 
. ** GDP
. import excel ${dirin}gdp_xc.xlsx, sheet("Data") firstrow clear

. rename nome_prov name_prov

. replace  name_prov=lower(name_prov)
(108 real changes made)

. reshape long gdp, i(name_prov) j (year)
(note: j = 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                      110   ->    1650
Number of variables                  16   ->       3
j variable (15 values)                    ->   year
xij variables:
            gdp2000 gdp2001 ... gdp2014   ->   gdp
-----------------------------------------------------------------------------

. rename gdp gdp_xc

. destring, replace
name_prov contains nonnumeric characters; no replace
year already numeric; no replace
gdp_xc already numeric; no replace

. save ${dirout}gdp_xc.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/gdp_xc.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/gdp_xc.dta saved

. 
. 
. ** DSP
. import excel ${dirin}dsp.xls, sheet("Foglio1") firstrow clear

. gen dps_01= pop_censo01>5000

. gen dps_11= pop_censo11>5000

. collapse dps_01 dps_11, by(cod_prov)

. save ${dirout}dsp.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/dsp.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/dsp.dta saved

. 
. 
. ** EXPORTS
. use ${dirin}exports.dta, clear

. keep nome_prov year tot_exp

. rename nome_prov name_prov

. save ${dirout}exports.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/exports.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/exports.dta saved

. 
. 
. ** PROCUREMENTS
. use ${dirin}procurement.dta, clear

. keep year nome_prov importo_iniziale

. rename nome_prov name_prov

. rename importo_iniziale procurement

. save ${dirout}procurement.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/procurement.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/procurement.dta saved

. 
. 
. ** EU FUNDS
. use ${dirin}eu_funds.dta, clear

. drop code_prov

. rename nome_prov name_prov

. rename tot_pagamenti_eu fund_eu

. save ${dirout}eu_funds.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/eu_funds.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/eu_funds.dta saved

. 
. 
. ** PROVINCE COORDINATES
. use ${dirin}prov_db.dta, clear

. keep nome_prov x_centr_ y_centr_ id_uniq

. rename nome_prov name_prov

. rename id_uniq _ID

. rename x_centr_ longitude

. rename y_centr_ latitude

. save ${dirout}prov_db.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/prov_db.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/prov_db.dta saved

. 
. 
. *________________________________________ MERGING DATA
. use ${dirout}nuts_codes.dta, clear

. 
. merge 1:1 name_prov using ${dirin}surface.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                               110  (_merge==3)
    -----------------------------------------

. keep if _m==3
(0 observations deleted)

. drop _m

. 
. merge 1:m name_prov using ${dirout}dem_ent.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                             5
        from master                         5  (_merge==1)
        from using                          0  (_merge==2)

    matched                             1,155  (_merge==3)
    -----------------------------------------

. keep if _m==3
(5 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}construction.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           105
        from master                         0  (_merge==1)
        from using                        105  (_merge==2)

    matched                             1,155  (_merge==3)
    -----------------------------------------

. keep if _m==3
(105 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}research.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                            22
        from master                        22  (_merge==1)
        from using                          0  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(22 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}legal_form.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                            22
        from master                         0  (_merge==1)
        from using                         22  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(22 observations deleted)

. drop _m

. 
. merge m:1 name_prov using ${dirout}tmi.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(0 observations deleted)

. drop _m

. 
. merge m:1 name_prov using ${dirout}tmi_pre.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(0 observations deleted)

. drop _m

. 
. merge m:1 name_prov using ${dirout}psi.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(0 observations deleted)

. drop _m

. 
. merge m:1 name_prov using ${dirout}confino.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           297
        from master                       297  (_merge==1)
        from using                          0  (_merge==2)

    matched                               836  (_merge==3)
    -----------------------------------------

. drop _m

. 
. merge m:m name_prov year using ${dirout}art416_bis.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           309
        from master                         0  (_merge==1)
        from using                        309  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(309 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}tourism.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                            77
        from master                         0  (_merge==1)
        from using                         77  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(77 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}wastes.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                            77
        from master                         0  (_merge==1)
        from using                         77  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(77 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}banks.dta
(note: variable cod_prov_nuts was str5, now str7 to accommodate using data's values)
(note: variable year was int, now float to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                            36
        from master                         0  (_merge==1)
        from using                         36  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(36 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}credits.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                         1,014
        from master                         0  (_merge==1)
        from using                      1,014  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(1014 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}self_emp.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(0 observations deleted)

. drop _m

. 
. merge m:m name_reg year using ${dirout}blood.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(0 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}trials.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(0 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}newspapers.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                            21
        from master                         0  (_merge==1)
        from using                         21  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(21 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}un_rate.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                            77
        from master                         0  (_merge==1)
        from using                         77  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(77 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}pop_tot.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(0 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}pop_urb.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                            11
        from master                         0  (_merge==1)
        from using                         11  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(11 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}gdp_xc.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           517
        from master                         0  (_merge==1)
        from using                        517  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(517 observations deleted)

. drop _m

. 
. merge m:1 cod_prov using ${dirout}dsp.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                             7
        from master                         0  (_merge==1)
        from using                          7  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(7 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}exports.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           297
        from master                         0  (_merge==1)
        from using                        297  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(297 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}procurement.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           737
        from master                         0  (_merge==1)
        from using                        737  (_merge==2)

    matched                             1,133  (_merge==3)
    -----------------------------------------

. keep if _m==3
(737 observations deleted)

. drop _m

. 
. merge m:m name_prov year using ${dirout}eu_funds.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           711
        from master                       446  (_merge==1)
        from using                        265  (_merge==2)

    matched                               687  (_merge==3)
    -----------------------------------------

. drop if _m==2
(265 observations deleted)

. drop _m

. 
. append using ${dirin}dem_ent_extended.dta
(note: variable pop_tot was long, now double to accommodate using data's values)

. 
. 
. merge m:1 name_prov using ${dirout}prov_db.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                             1,751  (_merge==3)
    -----------------------------------------

. keep if _m==3
(0 observations deleted)

. drop _m

. 
. merge m:1 name_prov using ${dirin}prov_coord_180.dta
(note: variable name_prov was str28, now str35 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                            13
        from master                         0  (_merge==1)
        from using                         13  (_merge==2)

    matched                             1,751  (_merge==3)
    -----------------------------------------

. keep if _m==3
(13 observations deleted)

. drop _m

. 
. 
. 
. 
. *________________________________________ VARIABLES CONSTRUCTION
. 
. 
. *_________________ OUTCOMES
. gen new_std= (new/pop_tot)*100000

. gen new_std_ln=ln(new_std)

. label var new_std "New enterprises (100,000 inh.)"

. label var new_std_ln "New enterprises"

. drop new

. 
. gen construction_std= (construction/pop_tot)*100000
(618 missing values generated)

. gen construction_std_ln=ln(construction_std)
(618 missing values generated)

. label var construction_std_ln "Construction"

. drop construction

. 
. gen ric_std= (research/pop_tot)*100000
(618 missing values generated)

. gen ric_std_ln=ln(ric_std)
(618 missing values generated)

. label var ric_std_ln "Research"

. drop research 

. 
. gen limited_std= (limited/pop_tot)*100000
(618 missing values generated)

. gen limited_std_ln=ln(limited_std)
(618 missing values generated)

. label var limited_std_ln "Lim. Liab."

. drop limited

. 
. gen closed_std= (closed/pop_tot)*100000

. gen closed_std_ln=ln(closed_std)

. label var closed_std_ln "Closed enterprises"

. drop closed

. 
. gen registered_std= (registered/pop_tot)*100000

. gen registered_std_ln=ln(registered_std)

. label var registered_std_ln "Registered enterprises"

. drop registered

. 
. gen proc_std=((procurement/pop_tot)*100000)/1000
(623 missing values generated)

. gen proc_std_ln=ln(proc_std)
(623 missing values generated)

. label var proc_std_ln "Public proc."

. drop procurement

. 
. gen ln_gdp=ln(gdp_xc)
(618 missing values generated)

. label var ln_gdp "GDP per capita (ln)"

. 
. gen tot_exp_r=((tot_exp*1000)/(gdp*pop_tot))
(618 missing values generated)

. label var tot_exp_r "Export/GDP"

. drop tot_exp 

. 
. gen flag=name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia"

. bysort year flag: egen tot_fund_eu=sum(fund_eu) if flag==1
(209 missing values generated)

. gen fund_eu_std= fund_eu/tot_fund_eu
(1197 missing values generated)

. label var fund_eu_std "EU funds"

. drop flag fund_eu tot_fund_eu 

. 
. replace un_rate=un_rate/100
(1133 real changes made)

. label var un_rate "Unemp. rate"

. 
. 
. *_________________ CRISIS
. gen crisis=year>2006

. label var crisis "Crisis"

. label var year "Year"

. 
. 
. *_________________ TMI
. bysort name_prov: egen tmi_e=max(tmi)
(323 missing values generated)

. drop tmi

. label var tmi_e "TMI"

. 
. ** Tertiles
. xtile tmi_q3=tmi_e if name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia" , n(3)

. label define tmi_q3 1"Low Mafia" 2"Mid. Mafia" 3"High Mafia"

. label value tmi_q3 tmi_q3

. label var tmi_q3 "Tertiles of TMI"

. 
. gen mafia_n3=1 if  tmi_q3==3 
(1275 missing values generated)

. replace mafia_n3=0 if  tmi_q3<3 
(952 real changes made)

. label var mafia_n3 "Mafia"

. label define mafia_n3 0 "No Mafia" 1 "Mafia"

. label value mafia_n3 mafia_n3

. 
. gen crisis_mafia_n3_int=crisis*mafia_n3
(323 missing values generated)

. label var crisis_mafia_n3_int "MafiaXCrisis"

. 
. ** Quartiles
. xtile tmi_q4=tmi_e if name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia" , n(4)

. label var tmi_q4 "Quartiles of TMI"

. 
. gen mafia_n4=1 if  tmi_q4==4 
(1411 missing values generated)

. replace mafia_n4=0 if  tmi_q4<4 
(1088 real changes made)

. label var mafia_n4 "Mafia"

. label define mafia_n4 0 "No Mafia" 1 "Mafia"

. label value mafia_n4 mafia_n4

. 
. gen crisis_mafia_n4_int=crisis*mafia_n4
(323 missing values generated)

. label var crisis_mafia_n4_int "MafiaXCrisis"

. 
. ** Quintiles
. xtile tmi_q5=tmi_e if name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia" , n(5)

. label var tmi_q5 "Quintiles of TMI"

. 
. gen mafia_n5=1 if  tmi_q5==5
(1479 missing values generated)

. replace mafia_n5=0 if  tmi_q5<5 
(1156 real changes made)

. label var mafia_n5 "Mafia"

. label define mafia_n5 0 "No Mafia" 1 "Mafia"

. label value mafia_n5 mafia_n5

. 
. gen crisis_mafia_n5_int=crisis*mafia_n5
(323 missing values generated)

. label var crisis_mafia_n5_int "MafiaXCrisis"

. 
. ** Continuous
. gen tmi_cont=tmi_e*100 if name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia"
(323 missing values generated)

. label var tmi_cont "Mafia"

. 
. gen crisis_mafia_cont_int=crisis*tmi_cont
(323 missing values generated)

. label var crisis_mafia_cont_int "MafiaXCrisis"

. 
. 
. *_________________ TMI PRE
. bysort name_prov: egen tmi_pre_e=mean(tmi_pre)
(323 missing values generated)

. drop tmi_pre

. label var tmi_pre_e "TMI Pre"

. 
. ** Tertiles
. xtile tmi_q3_pre=tmi_pre_e if name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia", n(3)

. label var tmi_q3_pre "Tertiles of TMI Pre"

. 
. gen mafia_n3_pre=1 if  tmi_q3_pre==3
(1275 missing values generated)

. replace mafia_n3_pre=0 if  tmi_q3_pre<3
(952 real changes made)

. label var mafia_n3_pre "Mafia"

. 
. gen crisis_mafia_n3_pre_int=crisis*mafia_n3_pre
(323 missing values generated)

. label var crisis_mafia_n3_pre_int "MafiaXCrisis"

. 
. ** Quartiles
. xtile tmi_q4_pre=tmi_pre_e if name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia", n(4)

. label var tmi_q4_pre "Quartiles of TMI Pre"

. 
. gen mafia_n4_pre=1 if  tmi_q4_pre==4
(1394 missing values generated)

. replace mafia_n4_pre=0 if  tmi_q4_pre<4
(1071 real changes made)

. label var mafia_n4_pre "Mafia"

. 
. gen crisis_mafia_n4_pre_int=crisis*mafia_n4_pre
(323 missing values generated)

. label var crisis_mafia_n4_pre_int "MafiaXCrisis"

. 
. ** Quintiles
. xtile tmi_q5_pre=tmi_pre_e if name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia", n(5)

. label var tmi_q5_pre "Quintiles of TMI Pre"

. 
. gen mafia_n5_pre=1 if  tmi_q5_pre==5
(1479 missing values generated)

. replace mafia_n5_pre=0 if  tmi_q5_pre<5
(1156 real changes made)

. label var mafia_n5_pre "Mafia"

. 
. gen crisis_mafia_n5_pre_int=crisis*mafia_n5_pre
(323 missing values generated)

. label var crisis_mafia_n5_pre_int "MafiaXCrisis"

. 
. ** Continuous
. gen tmi_cont_pre=tmi_pre_e*100 if name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia"
(323 missing values generated)

. label var tmi_cont_pre "Mafia"

. 
. gen crisis_mafia_cont_pre_int=crisis*tmi_cont_pre
(323 missing values generated)

. label var crisis_mafia_cont_pre_int "MafiaXCrisis"

. 
. 
. *_________________ TMI -- Excluding also Apulia
. xtile tmi_q3_nopuglia=tmi_e if name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia" & name_reg!="pug
> lia", n(3)

. label var tmi_q3_nopuglia "Tertiles of TMI (no Apulia)"

. 
. gen mafia_n3_nopuglia=1 if  tmi_q3_nopuglia==3 
(1296 missing values generated)

. replace mafia_n3_nopuglia=0 if  tmi_q3_nopuglia<3 
(918 real changes made)

. label var mafia_n3_nopuglia "Mafia"

. 
. gen crisis_mafia_n3_nopuglia_int=crisis*mafia_n3_nopuglia
(378 missing values generated)

. label var crisis_mafia_n3_nopuglia "MafiaXCrisis"

. 
. 
. *_________________ TMI -- All provinces
. bysort name_prov: egen tmi_all_e=max(tmi_all)

. drop tmi_all

. label var tmi_all_e "TMI (All. Prov.)"

. 
. xtile tmi_q3_all=tmi_all_e, n(3)

. label var tmi_q3_all "Tertiles of TMI (All prov.)"

. 
. gen mafia_n3_all=1 if  tmi_q3_all==3
(1173 missing values generated)

. replace mafia_n3_all=0 if  tmi_q3_all<3
(1173 real changes made)

. label var mafia_n3_all "Mafia"

. 
. gen crisis_mafia_n3_all_int=crisis*mafia_n3_all

. label var crisis_mafia_n3_all "MafiaXCrisis"

. 
. 
. *_________________ PSI
. gen psi_e=1 if  psi>0 & name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia"
(891 missing values generated)

. replace psi_e=0 if  psi==0 & name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia"
(682 real changes made)

. drop psi

. label var psi_e "Mafia"

. gen crisis_mafia_psi=crisis*psi_e
(209 missing values generated)

. label var crisis_mafia_psi "MafiaXCrisis"

. 
. 
. *_________________ ART. 416 bis
. bysort name_prov: egen mean_ass=mean(art416_bis) 

. drop art416_bis

. replace mean_ass=round(mean_ass)
(1020 real changes made)

. 
. gen mafia_ass=1 if mean_ass>0 & name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia" 
(1445 missing values generated)

. replace mafia_ass=0 if mean_ass==0 & name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia" 
(1236 real changes made)

. drop mean_ass

. label var mafia_ass "Mafia"

. 
. gen crisis_mafia_ass_int=crisis*mafia_ass
(209 missing values generated)

. label var crisis_mafia_ass_int "MafiaXCrisis"

. 
. 
. *_________________ CONTROLS
. 
. gen credit_ln=ln((credit_tot/pop_tot)*100000)
(618 missing values generated)

. label var credit_ln "Total credits (100,000 inh., Ln)"

. 
. gen pop_urb=popurban/pop_tot
(618 missing values generated)

. drop popurban

. label var pop_urb "Urban population (perc.)"

. 
. replace newspapers=newspapers/(pop_tot/1000)
(1133 real changes made)

. gen newspapers_ln=ln(newspapers)
(618 missing values generated)

. label var newspapers "Newspaper circulation (1,000 inh.)"

. label var newspapers_ln "Newspaper circulation (1,000 inh., Ln)"

. 
. gen wastes_xc=wastes/pop_tot
(618 missing values generated)

. drop wastes

. label var wastes_xc "Wastes per capita (tons)"

. 
. gen south=(name_reg=="basilicata" | name_reg=="calabria" | name_reg=="campania" | name_reg=="puglia" | name_reg==
> "sicilia" | name_reg=="sardegna" | name_reg=="molise" | name_reg=="abruzzo")

. gen centre=(name_reg=="lazio" | name_reg=="marche" | name_reg=="toscana" | name_reg=="umbria")

. gen north_east=(name_reg=="emilia-romagna" | name_reg=="veneto" | name_reg=="trentino-alto adige" | name_reg=="fr
> iuli-venezia giulia")

. gen north_west=(name_reg=="piemonte" | name_reg=="liguria" | name_reg=="lombardia" | name_reg=="valle d'aosta/val
> l�e d'aoste")

. gen north=(north_east==1 | north_west==1)

. label var south "Southern Italy"

. label var north "Northern Italy"

. label var centre "Central Italy"

. label var north_east "North-eastern Italy"

. label var north_west "North-western Italy"

. 
. gen dsp=1 if dps_01==1 & year<=2011
(1742 missing values generated)

. replace dsp=1 if dps_11==1 & year>2011
(2 real changes made)

. replace dsp=0 if dsp==.
(1740 real changes made)

. drop dps_01 dps_11

. label var dsp "Domestic Stability Pact"

. 
. 
. label var big_banks "Big banks (perc.)"

. label var tourism "Tourism index"

. label var self_emp "Self-employed (perc.)"

. label var trial "Trial duration (days)"

. label var blood "Blood donations (Bags per 100 inh.)"

. 
. label var pop_tot "Population"

. label var surface "Surface (Km2)"

. 
. *_________________ CONFINO LAW
. 
. ** Aggregating controls of new provinces back to original provinces
. gen noprov=1 if name_prov=="biella" |  name_prov=="lecco" |  name_prov=="lodi" |  name_prov=="prato" |  name_prov
> =="rimini" |  name_prov=="verbano-cusio-ossola" |  name_prov=="oristano"  
(1632 missing values generated)

. 
. gen f1=name_prov=="biella" |  name_prov=="vercelli" 

. gen f2=name_prov=="lecco" |  name_prov=="como" 

. gen f3=name_prov=="lodi" |  name_prov=="milano" 

. gen f4=name_prov=="prato" |  name_prov=="firenze" 

. gen f5=name_prov=="rimini" |  name_prov=="forli-cesena" 

. gen f6=name_prov=="verbano-cusio-ossola" |  name_prov=="novara" 

. gen f7=name_prov=="oristano" |  name_prov=="cagliari" 

. 
. foreach var1 in pop_urb tourism trial wastes_xc big_banks /*
> */  self_emp blood newspapers_ln  {
  2. local varlabel1: var label `var1'
  3. gen `var1'_iv=`var1'
  4. label var `var1'_iv "`varlabel1' (IV)"
  5. foreach var2 in f1 f2 f3 f4 f5 f6 f7 {
  6. bysort `var2' year: egen `var1'_`var2'_iv2=wtmean(`var1') if `var2'==1, weight(surface)
  7. replace `var1'_iv=`var1'_`var2'_iv2 if `var2'==1
  8. }
  9. }
(618 missing values generated)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(618 missing values generated)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(618 missing values generated)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(618 missing values generated)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(618 missing values generated)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(618 missing values generated)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(618 missing values generated)
(1729 missing values generated)
(0 real changes made)
(1729 missing values generated)
(0 real changes made)
(1729 missing values generated)
(0 real changes made)
(1729 missing values generated)
(0 real changes made)
(1729 missing values generated)
(0 real changes made)
(1729 missing values generated)
(0 real changes made)
(1729 missing values generated)
(0 real changes made)
(618 missing values generated)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)
(1729 missing values generated)
(22 real changes made)

. drop f1 f2 f3 f4 f5 f6 f7 *_iv2

. 
. 
. ** Mafia presence and instrument
. replace confined=0 if confined==.
(915 real changes made)

. gen co=confined if name_reg!="campania" & name_reg!="calabria" & name_reg!="sicilia"  & tmi_e!=. & noprov!=1
(442 missing values generated)

. drop confined noprov

. label var co "People resettled by confino"

. gen instrument=co*crisis
(442 missing values generated)

. label var instrument "ResettledXCrisis"

. 
. 
. *_________________ INTERACTION WITH YEAR DUMMIES -- Reference 2006 (year_10)
. label define year 1997 "(t-10)" 1998 "(t-9)" 1999 "(t-8)" 2000 "(t-7)" 2001 "(t-6)" /*
> */ 2002 "(t-5)" 2003 "(t-4)" 2004 "(t-3)" 2005 "(t-2)" 2006 "(t-1)" 2007 "(t)" /*
> */ 2008 "(t+1)" 2009 "(t+2)" 2010 "(t+3)" 2011 "(t+4)" 2012 "(t+5)" 2013 "(t+6)" 

. label value year year

. ta year, gen(year_)

       Year |      Freq.     Percent        Cum.
------------+-----------------------------------
     (t-10) |        103        5.88        5.88
      (t-9) |        103        5.88       11.76
      (t-8) |        103        5.88       17.65
      (t-7) |        103        5.88       23.53
      (t-6) |        103        5.88       29.41
      (t-5) |        103        5.88       35.29
      (t-4) |        103        5.88       41.18
      (t-3) |        103        5.88       47.06
      (t-2) |        103        5.88       52.94
      (t-1) |        103        5.88       58.82
        (t) |        103        5.88       64.71
      (t+1) |        103        5.88       70.59
      (t+2) |        103        5.88       76.47
      (t+3) |        103        5.88       82.35
      (t+4) |        103        5.88       88.24
      (t+5) |        103        5.88       94.12
      (t+6) |        103        5.88      100.00
------------+-----------------------------------
      Total |      1,751      100.00

. 
. 
. foreach var of varlist year_1 year_2 year_3 year_4 year_5  year_6 year_7 year_8 year_9 year_10 /*
> */ year_11 year_12 year_13 year_14 year_15 year_16 year_17  {
  2. local varlabel : var label `var'
  3. local newname = subinstr("`varlabel'","year==","",.)
  4. label variable `var' "`newname'"
  5. }

. 
. ** TMI 
. foreach var1 in mafia_n3 {
  2. local varlabel1: var label `var1'
  3. foreach var2 in year_1 year_2 year_3 year_4 year_5  year_6 year_7 year_8 year_9  /*
> */ year_11 year_12 year_13 year_14 year_15 year_16 year_17 {
  4. local varlabel2: var label `var2'
  5. gen `var2'_`var1'=`var2'*`var1'
  6. label var `var2'_`var1' "`varlabel1' x `varlabel2'"
  7. }
  8. }
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)

. 
. ta tmi_q3, gen(tmi_q3_)

Tertiles of |
        TMI |      Freq.     Percent        Cum.
------------+-----------------------------------
  Low Mafia |        476       33.33       33.33
 Mid. Mafia |        476       33.33       66.67
 High Mafia |        476       33.33      100.00
------------+-----------------------------------
      Total |      1,428      100.00

. label var tmi_q3_1 "Low Mafia"

. label var tmi_q3_2 "Mid Mafia"

. label var tmi_q3_3 "High Mafia"

. foreach var1 in tmi_q3_2 tmi_q3_3 {
  2. local varlabel1: var label `var1'
  3. foreach var2 in year_1 year_2 year_3 year_4 year_5  year_6 year_7 year_8 year_9  /*
> */ year_11 year_12 year_13 year_14 year_15 year_16 year_17 {
  4. local varlabel2: var label `var2'
  5. gen `var2'_`var1'=`var2'*`var1'
  6. label var `var2'_`var1' "`varlabel1' x `varlabel2'"
  7. }
  8. }
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)
(323 missing values generated)

. 
. ** CONFINO LAW
. foreach var1 in co {
  2. local varlabel1: var label `var1'
  3. foreach var2 in year_7 year_8 year_9  year_11 year_12 year_13 year_14 year_15 year_16 year_17 {
  4. local varlabel2: var label `var2'
  5. gen `var2'_`var1'=`var2'*`var1'
  6. label var `var2'_`var1' "`varlabel1' x `varlabel2'"
  7. }
  8. }
(442 missing values generated)
(442 missing values generated)
(442 missing values generated)
(442 missing values generated)
(442 missing values generated)
(442 missing values generated)
(442 missing values generated)
(442 missing values generated)
(442 missing values generated)
(442 missing values generated)

. 
. ** MACRO REGIONS -- Reference South and Islands
. foreach var1 in north centre north_east north_west{
  2. local varlabel1: var label `var1'
  3. foreach var2 in  year_1 year_2 year_3 year_4 year_5  year_6 year_7 year_8 year_9 /*
> */ year_11 year_12 year_13 year_14 year_15 year_16 year_17 {
  4. local varlabel2: var label `var2'
  5. gen `var2'_`var1'=`var2'*`var1'
  6. label var `var2'_`var1' "`varlabel1' x `varlabel2'"
  7. }
  8. }

. 
. 
. ** CONTROLS - 2006 value
. foreach var1 in credit_ln tourism trial wastes_xc big_banks newspapers_ln pop_urb self_emp blood {
  2. local varlabel1: var label `var1'
  3. gen `var1'_flag=`var1' if year==2006
  4. bysort name_prov: egen `var1'_2006=mean(`var1'_flag)
  5. label var `var1'_2006 "`varlabel1'(2006)"
  6. drop `var1'_flag
  7. }
(1648 missing values generated)
(1648 missing values generated)
(1648 missing values generated)
(1648 missing values generated)
(1648 missing values generated)
(1648 missing values generated)
(1648 missing values generated)
(1648 missing values generated)
(1648 missing values generated)

. 
. 
. foreach var1 in dsp credit_ln_2006 tourism_2006 trial_2006 wastes_xc_2006 big_banks_2006 /*
> */ newspapers_ln_2006 pop_urb_2006 self_emp_2006 blood_2006 {
  2. local varlabel1: var label `var1'
  3. foreach var2 in year_7 year_8 year_9  year_11 year_12 year_13 year_14 year_15 year_16 year_17 {
  4. gen `var2'_`var1'=`var2'*`var1'
  5. label var `var2'_`var1' "`varlabel1' x `varlabel2'"
  6. }
  7. }

. 
. 
. egen id=group(name_prov)

. xtset id year
       panel variable:  id (strongly balanced)
        time variable:  year, 1997 to 2013
                delta:  1 unit

. 
. 
. save ${dirout}final_database.dta, replace
(note: file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/final_database.dta not found)
file /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/final_database.dta saved

. 
. log close
      name:  <unnamed>
       log:  /Users/marcolemoglie/Dropbox/Mafia/1_Do_Files/Final/CLEANED_DATA/Building_sample.log
  log type:  text
 closed on:  12 May 2020, 18:27:23
-------------------------------------------------------------------------------------------------------------------
